import { defineComponent, ref, nextTick, provide } from 'vue'
import { ConfigProvider } from 'ant-design-vue'
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import { RouterView } from 'vue-router'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'

export default defineComponent({
  name: 'App',
  setup() {
    dayjs.locale('zh-cn')
    const referash = ref<boolean>(true)
    const reload = () => {
      referash.value = false
      console.log('刷新了')
      nextTick(() => (referash.value = true))
    }
    provide('reload', reload)
    return () => (
      <ConfigProvider locale={zhCN}>
        {referash.value && <RouterView></RouterView>}
      </ConfigProvider>
    )
  },
})
